Here is a subscription definition example based on external data.
<subscription name="onLoad" subscription-class="com.axemble.vdp.mapping.extensions.SQLResourceMappingExtension"> <sql reference="SQLReference_1" order="SELECT PRODUCTNAME FROM VDOC_PRODUCTS"> </sql> <action field-id="Field_1" throw-events="false" update-mode="both" sql-type="VARCHAR" field-list="PRODUCTNAME"/> </subscription>
When the document is loaded, the "onLoad" type subscription will be processed. It will fill the "Field_1" field list with the product name of each returned row by running the SQL request.
<subscription field-id="Field_1" name="onChange" subscription-class="com.axemble.vdp.mapping.extensions.SQLResourceMappingExtension"> <on-stage name="Stage_1"/> <on-stage name="Stage_2"/> <sql reference="SQLReference_1" order="SELECT * FROM Table_1 WHERE Column_1 =?"> <bind field-id="Field_1" prop-id="" sql-type="VARCHAR"/> </sql> <action field-id="Field_2" prop-id="" throw-events="false" update-mode="both" sql-type="FLOAT" field-list="column_2"/> <action field-id="Field_3" prop-id="" throw-events="false" update-mode="both" sql-type="FLOAT" field-value="column_3"/> </subscription>
The second SQL subscription example will run on altering the value of the "Field_1" field. The "Field_2" and "Field_3" fields will take the value of the "column_2" and "column_3" columns respectively.
The on-stage tags indicate that this subscription will only be acknowledged in steps "Stage_1" and "Stage_2". If you want them to be processed each time that the value of "Field_1" field is altered, delete these lines.
The bind tag is the means to enter constraints on the SQL order dependent on the values of other fields.
The "subscription" element defines the subscription input. Used in the resource template XML.
Element | Description | Where to find more information? |
field-id | Modified document field and trigger of the "onChange" event. | |
name | Name of occurred event | |
prop-id | Not available | |
subscription-class | Extension class: com.axemble.vdp.mapping.extensions.SQLResourceMappingExtension |
The "on-stage" element defines the input of a step on which the subscription will be run.
Element | Description | Where to find more information? |
name | System name of the concerned step The keyword « sys_CreationWizard »enables to indicate that the treatment will be processed only on the action of process document creation. |
The "sql" element defines the SQL request to the external database which will be run.
Element | Description | Where to find more information? |
reference | Name of the external reference defined on the affiliated organization and allowing connection to an external database. | |
order | SQL order to be run. |
The "bind" element associates a SQL request parameter to a document field. You should have as many as « ? » in the request as declared « bind » . The order of "bind" is important.
Element | Description | Where to find more information? |
field-id | System name of the document field whose value will be taken as the request parameter. | |
prop-id | Name of the "get" type property or method that will allow introspection of the bind object. | |
sql-type | SQL type for storage of parameter field. |
The "action" element defines the input of an action to be performed after an event is triggered. Used in XML of the resource template
Element | Description | Where to find more information? |
field-id | System name of the subscribed field | |
prop-id | Not available | |
throw-events | ||
update-mode | ||
field-list / field-value | Request field that will be used to update the document field based on whether it is of list type (field-list) or not (field-value). | |
sql-type | SQL type for storage of field to be updated. (VARCHAR or FLOAT) |
Actions define all the document fields that will be updated when subscription is run. Actions can only be defined at the XML document level of the resource template. It is possible to define 1 to n actions.
Filters on steps can be placed to restrict subscriptions running on some steps. If no step has been specified, the subscription will be valid at all steps of the document. Filters are defined at the XML document level of the resource template. The on-stage tags can be present from 0 to n times.
The SQL request constraints are defined as binds at the XML document level. Each bind tag will therefore represent a request "?". » de la requête. Warning, the order must be maintained.
In case of "OnLoad' type subscription, the constraints can also be defined at the level of Lists Administration. Similarly, each added field constraint should be in the order of the request "?". » .